import {
  createRouter,
  createWebHashHistory,
  createWebHistory,
} from "vue-router";
import Home from "../views/Home";
import { error404Page, error401Page } from "./modules/errorPage";

const routes = [
  {
    path: "/",
    redirect: "/home", //重定向
  },
  {
    path: "/home",
    name: "Home",
    component: Home,
    meta: {
      title: "首页",
    },
  },
  {
    path: "/dashboard",
    name: "Dashboard",
    component: () => import("../views/Dashboard"),
    meta: {
      title: "知识汇总",
    },
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("../views/Login"),
    meta: {
      title: "登录",
    },
  },
  {
    path: "/changePassword",
    name: "ChangePassword",
    component: () => import("../views/changePassword"),
    meta: {
      title: "修改密码",
    },
  },
  error404Page,
  error401Page,
];
const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes,
});

export default router;
